from pyecharts import options as opts
from pyecharts.charts import Funnel
from pyecharts.globals import ThemeType

from demo.dataSource.Data import data

data_xz = data.loc[data['新增无症状']!=0,:]
data_xz["新增无症状"]
a=data_xz["省市地区"].to_list()
b=data_xz["新增无症状"].to_list()
funnel = (
    Funnel(init_opts=opts.InitOpts(theme=ThemeType.LIGHT,
                                   width="700px",
                                   height="700px",
                                   ))
        .add(
        "无症状病例数",
        [list(z) for z in zip(a, b)],
        sort_="descending",  # 数据排序:下降
        label_opts=opts.LabelOpts(position="inside"),

    )
        .set_global_opts(
        title_opts=opts.TitleOpts(
            title="新增无症状数量情况",
            pos_top='10px',
            pos_left='40%',
            title_textstyle_opts=opts.TextStyleOpts(color='#CCFFFF', )),
        legend_opts=opts.LegendOpts(
            pos_top='35%',
            pos_left='10%',
            orient='vertical',  # 布局朝向:垂直

        ),

    )

)
funnel.render("../outHTML/funnel.html")